const tree = require('./tree')

// 广度优先
const bfs = (root) => {
    const q = [tree]
    
    while(q.length) {
        const n = q.shift()
        console.log(n.val)
        n.children.forEach(item => {
            q.push(item)
        })
    }
}

bfs(tree)